﻿
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>

  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/system">电商管理</a></li>
          <li class="active">课程管理</li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>课程管理&nbsp;-&nbsp;课程列表</span></h2>
            </div>
          </div>
          
          <table class="table table-striped table-hover x-table" style="margin-bottom:20px;">
            <thead>
              <tr>
                <th>课程名称</th>
                <th>课程类型</th>
                <th class="text-center">操作</th>
              </tr>
            </thead>
            <tbody>
		<c:set var="flag" value="0"></c:set>
              <c:forEach var="course" items="${courses}">
		<c:if test="${(course.name=='线下1v1' and flag eq 0) or (course.name != '线下1v1' and course.online == false)}">
			<c:set var="flag" value="1"></c:set>
                <tr>
                  <td>${course.name}</td>
                  <td>${course.online ? '线上课程' : '线下课程'}</td>
                  <td class="text-center">
                    <a href="${ctx.host}/courses/${course.id}" >详情</a>&nbsp;&nbsp;
                  </td>
                </tr>
		</c:if>
              </c:forEach>
              <c:forEach var="course" items="${courses}">
		<c:if test="${course.online == true}">
                <tr>
                  <td>${course.name}</td>
                  <td>${course.online ? '线上课程' : '线下课程'}</td>
                  <td class="text-center">
                    <a href="${ctx.host}/courses/${course.id}" >详情</a>&nbsp;&nbsp;
                  </td>
                </tr>
		</c:if>
              </c:forEach>
		
            </tbody>
          </table>
          
        </div>

      </div>

    </div>

  </div>

  <%@ include file="/WEB-INF/include/footer.jsp"%>
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/ecommerce/course/course-list.js">
    <script type="text/javascript">
      require(['page/ecommerce/course/course-list'],function(page){
          page.init();
      })
    </script>
  </d:resource>

</body>

</html>

<script type="text/javascript">

    function unique(arr1) {
        const res = new Map();
        return arr1.filter((a) => !res.has(a.name) && res.set(a.name, 1))
    }

</script>

